package io.renren.modules.cannal;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.xpand.starter.canal.annotation.CanalEventListener;
import com.xpand.starter.canal.annotation.ListenPoint;

/**
 * @Author: LiuZhen
 * @Created: 2021/7/16 13:32
 * @Description:
 */
//@CanalEventListener
public class TestListener {
    /**
     * cannal 自定义监听
     * @param eventType 监听的事件
     * @param rowData 内容
     */
    //@ListenPoint(schema = "mall-admin",table = "schedule_job")
    public void job(CanalEntry.EventType eventType, CanalEntry.RowData rowData){
        System.out.println(eventType);
        System.out.println("测试分支修改代码");

        //改变之前
        //
        rowData.getBeforeColumnsList().forEach((c)-> System.out.println("改变前的数据:"+c.getName()+":"+c.getValue()));

        System.out.println("===========================");
        //获取改变之后的数据
        rowData.getAfterColumnsList().forEach((c)-> System.out.println("改变之后的数据:"+c.getName()+":"+c.getValue()));

    }
}
